package com.ddfeiyu.configuration;

import com.ddfeiyu.aspect.TraceLogAspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

@Configuration
@AutoConfigureOrder(Integer.MAX_VALUE)
@EnableAspectJAutoProxy(proxyTargetClass = true)
@ConditionalOnClass({Logger.class})
@ConditionalOnMissingBean({TraceLogAspect.class})
public class TraceLogAutoConfiguration {

    private static final Logger log = LoggerFactory.getLogger(TraceLogAutoConfiguration.class);

    @Bean
    public TraceLogAspect traceLogAspect() {
        log.info("--TraceLogAutoConfiguration.traceLogAspect---");
        return new TraceLogAspect();
    }


}
